package com.baizhi.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer{

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor().addPathPatterns().excludePathPatterns()
    }

    /**
     * 配置请求和页面视图映射, 请求接口/lzm，直接返回lzm.html的页面
     *                      请求接口/hello，直接返回hello.html的页面
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/lzm").setViewName("lzm");
        //配置请求和页面视图映射， 即将请求映射为针对静态页面资源的请求,可以减少页面资源请求接口的开发
    }
}
